home *** CD-ROM | disk | FTP | other *** search
/ Creative Review 28 / Creative-Review-CD-ROM-28.iso / pc / kungfu / assets / game.dir / 00007_Script_load class < prev    next >
Text File  |  1997-08-08  |  3KB  |  143 lines

  1. -- load class
  2. -- --------------------------------------------------
  3.  
  4. property list
  5. property loadedlist
  6.  
  7. -- ==================================================
  8. -- new method
  9. -- --------------------------------------------------
  10. on new me, props
  11.   
  12.   minit me, props
  13.   return me
  14.   
  15. end mnew 
  16.  
  17. -- ==================================================
  18. -- minit method
  19. -- --------------------------------------------------
  20. on minit me
  21.   
  22. --  put "in minit load class"
  23.   
  24.   set loadedlist = []
  25.   
  26.   set list = data2list ( "load data" )
  27.   
  28.   set alwayslist = [ #player ]
  29.   
  30.   repeat with name in alwayslist
  31.     mload me, name
  32.   end repeat
  33.   
  34. --  put "out minit load class"
  35.   
  36. end minit
  37.  
  38. -- ==================================================
  39. -- mload method
  40. -- --------------------------------------------------
  41. on mload me, which
  42.   
  43. --  put "in mload: " , which
  44.   
  45. --  mshowk me
  46.   
  47.   set whichlist = getaprop ( list , which )
  48.   
  49.   preloadmember the in of whichlist, the out of whichlist
  50.   
  51.   add loadedlist, which
  52.   
  53. --  mshowk me
  54.   
  55. --  put "out mload: "
  56.   
  57. end mload
  58.  
  59. -- ==================================================
  60. -- munload method
  61. -- --------------------------------------------------
  62. on munload me, which
  63.   
  64. --  put "in munload: " , which
  65.   
  66. --  mshowk me
  67.   
  68.   set whichlist = getaprop ( list , which )
  69.   
  70.   unloadmember the in of whichlist, the out of whichlist
  71.   
  72.   deleteone loadedlist, which
  73.   
  74. --  mshowk me
  75.   
  76. --  put "out munload: " 
  77.   
  78. end munload
  79.  
  80. -- ==================================================
  81. -- mdispose method
  82. -- --------------------------------------------------
  83. on mdispose me
  84.   
  85.   put "in mdispose: " 
  86.   
  87.   repeat with index = 1 to count ( list )
  88.     set name = getpropat ( list, index )
  89.     munload me, name
  90.   end repeat
  91.   
  92.   put "out mdispose: "
  93.   
  94. end mdispose
  95.  
  96.  
  97. -- ==================================================
  98. -- mshowk method
  99. -- --------------------------------------------------
  100. on mshowk me
  101.   
  102.   put the freebytes / 1024
  103.   
  104. end mshowk
  105.  
  106. -- ==================================================
  107. -- mwhich method
  108. -- --------------------------------------------------
  109. on mwhich me, castname
  110.   
  111. --  put "in mwhich" , castname
  112.   
  113.   if integerp ( castname ) then set thenum = castname
  114.   else set thenum = the number of cast castname
  115.   
  116.   -- put thenum
  117.   
  118.   repeat with index = 1 to count ( list )
  119.     
  120.     set thename = getpropat ( list , index )
  121.     set thelist = getat ( list, index )
  122.     
  123.     -- put thename, thelist 
  124.     
  125.     set in = the number of cast the in of thelist
  126.     set out = the number of cast the out of thelist
  127.     
  128.     -- put in , out
  129.     
  130.     if ( thenum >= in ) and ( thenum <= out ) then 
  131.       -- put castname && thename
  132.       return thename
  133.       exit repeat
  134.     end if
  135.     
  136.   end repeat
  137.   
  138.   return false
  139.   
  140. --  put "out mwhich"
  141.   
  142. end mwhich
  143.